package horoclient;

import java.net.InetAddress;

import javax.swing.SwingUtilities;
import client.*;

public final class RunClient {
	public static int SERVER_PORT = 49302;
	public static final String SERVER_NAME = "sand.cise.ufl.edu";
	static InetAddress SERVER_IP ;
	static {
		try { SERVER_IP = InetAddress.getByName(SERVER_NAME); } catch (Exception e){}
	}
	
	public static void main (String [] arg) {
//		hack(); //Local Server
		
		NetworkClient nc = new NetworkClient(SERVER_IP, SERVER_PORT);
		ClientGameState cgs = new ClientGameState();
		final SwingGui sg = new SwingGui(SERVER_NAME,SERVER_PORT,cgs);
		SwingUtilities.invokeLater(new Runnable(){public void run(){sg.setVisible(true);}});
		
		nc.addObserver(cgs);
		//cgs.addObserver(sg);
		cgs.listen(); //Infinite loop
		System.err.println("Main Thread is Dead");
	}
	
//	public static void hack() {
//		Server server = new Server( SERVER_PORT );
//		server.start();
//	}
	
}
